package Day05;

public class Test2 {
    public static void main(String[] args) {
        int[] arr={5,7,9,8,3,4};
        int max=arr[0];
        int min=arr[0];
        for (int i = 1; i <arr.length ; i++) {
            if(arr[i]>max){
                max=arr[i];
            }else if(arr[i]<min){
                min=arr[i];
            }
        }
        System.out.println("最大值与最小值的和为"+(max+min));
    }
}
